<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<!-- 常量：程序执行过程中不能修改值 -->
 <script>
    const pi = 3.14,userName='admin';
    console.log(pi);
    console.log(userName);
    //userName='强哥';            //常量不能修改值
    console.log(userName);
    console.log('----------数据类型---------');
    let istrue=true;
    console.log(istrue);
    istrue=false;
    console.log(istrue);
    console.log(typeof(istrue));    //输出变量的数据类型
    console.log('----------数值型-----------');
    let num1=234,num2=-3.45,num3=0x23;
    console.log(num1);
    console.log(num2);
    console.log(num3);
    console.log(typeof(num3));
    console.log('----------字符型----------');
    let str1='hello',str2="你好，强哥";
    console.log(str1);
    console.log(str2);
    console.log(typeof(str1));
    // 在控制台输出以下内容：他说：“他想强哥给他当辅导员”;
    let str3="他说，他想强哥给他当辅导员";
    console.log(str3);
    let str4='',str5=null,str6,flag1=true,flag2=false;
    console.log(str4);
    console.log(str5);
    console.log(str6);
    console.log(typeof(str4));
    console.log(typeof(str5));
    console.log('------------将其它数据类型转为Boolean型---------------')
    let num4=23,num5=0,num6,num7=null,str7='强哥';
    console.log(Boolean(num4));    //true
    console.log(Boolean(num5));    //false
    console.log(Boolean(num6));    //false
    console.log(Boolean(num7));    //false
    console.log(Boolean(str7));    //true
    console.log(Boolean(str4));    //false
    console.log('------------将其它数据转换为数值型-----------');
    console.log(Number(str4));    //0
    console.log(Number(str5));    //0
    console.log(Number(str6));    //NaN:Not a Number(非数值)
    console.log(Number(flag1));   //1
    console.log(Number(flag2));   //0
    console.log(Number(str7));    //NaN:Not a Number(非数值)
 </script>
</html>